package com.zzty.txj1.dao;

import com.zzty.txj1.entity.Event;
import org.apache.ibatis.annotations.*;

import java.util.List;

@Mapper
public interface EventDao {
    @Select("select * from event where id=#{id}")
    Event getEventById(Event event);

    @Insert("insert into event (name,money,startTime,endTime,checkLocation,locations) values(#{name},#{money},#{startTime},#{endTime},#{checkLocation},#{locations});")
    Integer addEvent(Event event);

    @Select("select * from event")
    List<Event> allEvent();

    @Delete("delete from event where id=#{id};")
    Integer deleteEventById(@Param("id") Integer id);

    @Select("select id from event where name=#{name}")
    Integer getEventIdByName(String name);

    @Select("select locations from event where name=#{name};")
    String getLocationsByEventName(Event event);

    @Update("update event set name=#{name},money=#{money},startTime=#{startTime},endTime=#{endTime},checkLocation=#{checkLocation},locations=#{locations} where id=#{id}")
    Integer updateEventById(Event event);

    @Select("select * from event where id=#{id}")
    Event getEventById1(Integer id);

}
